<?php
App::uses('Component', 'Controller');

class MessageComponent extends Component {
    
    public function sendSMS($Text, $To, $From = 1469) {
        
        if( trim($Text) == "" ) {
            return false;
        }
        
          $msg = urlencode($Text);
          $send_no = $To;
          $url ="http://121.241.242.114:8080/bulksms/bulksms?username=sob-nestle&password=nestle&type=0&dlr=0&destination=".$send_no."&source=1469&message=".$msg;  
          file_get_contents($url);
          
          return;
        
        /*
        $port = 2799;
        $Text = urlencode($Text);
        //$User = "cashboard1";
        //$Pass = "cashew1";
        //$User = "mycloudhttp";
        //$Pass = "myhttp";
        $User = "con12";
        $Pass = "sum12";
        $url = "23.21.156.138/Receiver.php?From=$From&To=$To&Text=$Text&User=$User&Pass=$Pass";

        if( substr($To, 0, 5) == "23323" ) {
            $To = $To;
        }

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_PORT, $port);
        curl_setopt($ch, CURLOPT_TIMEOUT, 2400);
        curl_setopt($ch, CURLOPT_LOW_SPEED_LIMIT, 10000);
        curl_setopt($ch, CURLOPT_LOW_SPEED_TIME, 5);
        //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $result = curl_exec($ch);
        curl_close($ch);
        
        
        return $result;*/
    }
}
?>
